<template>
  <div class="bran-list">
    <div
      @click="itemClick(item)"
      class="bran-list-item"
      v-for="item in brandList"
      :key="item.id"
    >
      <img :src="item.new_pic_url" alt="" />
      <div class="text">
        <div class="title">{{ item.name }}</div>
        <div class="price">{{ item.floor_price | filterPrice }}</div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  props: {
    brandList: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {
      iid: null,
    };
  },
  filters: {
    filterPrice(val) {
      return val + "元起";
    },
  },
  methods: {
    itemClick(item) {
      let index = this.brandList.findIndex((items) => items.id == item.id);
      this.iid = this.brandList[index].id;
      console.log(this.iid);
      this.$router.push({
        path: '/project',
        query: {
          id: this.iid
        }
      })
      // this.getBrands();
    },
    
  },
};
</script>

<style lang="scss" scoped>
.bran-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 10px 5px;
  background-color: #fff;
  .bran-list-item {
    width: 49%;
    position: relative;
    margin-bottom: 5px;
    img {
      width: 100%;
    }
    .text {
      position: absolute;
      left: 5px;
      top: 10px;
      .title,
      .price {
        margin: 10px;
      }
    }
  }
}
</style>